package com.purchase.ml.entity.order;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;

@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("sys_order_state")
@ApiModel(value = "SysOrderState", description = "订单状态表")
public class SysOrderState implements Serializable {
    @TableId(value = "id", type = IdType.AUTO)
    @ApiModelProperty(value = "")
    private Long id;

    @TableField(value = "oid")
    @ApiModelProperty(value = "")
    private Long oid;

    /**
     * 变更时间
     */
    @TableField(value = "state_chage_at")
    @ApiModelProperty(value = "变更时间")
    private Date stateChageAt;

    /**
     * 0:待付款；1:已支付；2已发货；3：配送中；4：已送达；5已签收
     */
    @TableField(value = "state")
    @ApiModelProperty(value = "0:待付款；1:已支付；2已发货；3：配送中；4：已送达；5已签收")
    private Integer state;

    @TableField(exist = false)
    private String stateDescrip;

    private static final long serialVersionUID = 1L;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getOid() {
        return oid;
    }

    public void setOid(Long oid) {
        this.oid = oid;
    }

    public Date getStateChageAt() {
        return stateChageAt;
    }

    public void setStateChageAt(Date stateChageAt) {
        this.stateChageAt = stateChageAt;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getStateDescrip() {
        String dec = "";
        switch (this.state){
            case 0:
                dec="Menunggu Pembayaran";
                break;
            case 1:
                dec="Pembayaran Lengkap";
                break;
            case 2:
                dec="Mula Penghantaran";
                break;
            case 3:
                dec="Dalam Penghantaran";
                break;
            case 4:
                dec="Ketibaan";
                break;
            case 5:
                dec="Diterima";
                break;
        }

        stateDescrip = dec;
        return stateDescrip;
    }

    public void setStateDescrip(String stateDescrip) {
        this.stateDescrip = stateDescrip;
    }
}